package com.wzu.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

@TableName("area")
public class Division {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String code;
    private String name;
    private Integer level;
    private String parentId;
    private String countyId;
    private String townId;

    public Division() {}
    public Division(Long id, String code, String name, Integer level, String parentId, String countyId, String townId) {
        this.id = id;
        this.code = code;
        this.name = name;
        this.level = level;
        this.parentId = parentId;
        this.countyId = countyId;
        this.townId = townId;
    }
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    public String getCode() { return code; }
    public void setCode(String code) { this.code = code; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public Integer getLevel() { return level; }
    public void setLevel(Integer level) { this.level = level; }
    public String getParentId() { return parentId; }
    public void setParentId(String parentId) { this.parentId = parentId; }
    public String getCountyId() { return countyId; }
    public void setCountyId(String countyId) { this.countyId = countyId; }
    public String getTownId() { return townId; }
    public void setTownId(String townId) { this.townId = townId; }

    @Override
    public String toString() {
        return "Division{" +
                "id=" + id +
                ", code='" + code + '\'' +
                ", name='" + name + '\'' +
                ", level=" + level +
                ", parentId='" + parentId + '\'' +
                ", countyId='" + countyId + '\'' +
                ", townId='" + townId + '\'' +
                '}';
    }

    public String getLevelText() {
        switch (level) {
            case 1: return "县";
            case 2: return "镇";
            case 3: return "村";
            default: return "" + level;
        }
    }
} 